package com.dwd.org.service.impl;

import com.dwd.basic.service.impl.BaseServiceImpl;
import com.dwd.basic.utils.PageBean;
import com.dwd.org.mapper.DictionaryDetailMapper;
import com.dwd.org.pojo.DictionaryDetail;
import com.dwd.org.pojo.DictionaryType;
import com.dwd.org.query.DictionaryDetailQuery;
import com.dwd.org.service.IDictionaryDetailService;
import com.dwd.org.service.IDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Description: TODO
 * @Author 汶狄
 * @Date 2021/1/11 11:02
 * @Version 1.0
 */
@Service
public class DictionaryDetailImpl extends BaseServiceImpl<DictionaryDetail> implements IDictionaryDetailService {
    @Autowired
    private DictionaryDetailMapper dictionaryDetailMapper;

    @Override
    public PageBean<DictionaryDetail> queryPage(DictionaryDetailQuery query, Long id) {
        Integer begin = query.getBegin();
        Integer pageSize = query.getPageSize();
        String keywords = query.getKeywords();
        //总条数
        Long count = dictionaryDetailMapper.queryCountDetail(keywords, id);
        if (count == 0) {
            return new PageBean<>();
        }
        List<DictionaryDetail> list = dictionaryDetailMapper.queryPageBytypesid(begin, pageSize, keywords, id);
        return new PageBean<>(count, list);
    }
}
